<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of FriendlyLinkService
 *
 * @author Administrator
 */
class FriendlyLinkService {

    function findFLByName($name, $model) {
        $where['name'] = array('eq', $name);
        $where['model'] = array('eq', $model);
        return D('friendly_link')->where($where)->find();
    }

    function create() {
        return D('friendly_link')->create();
    }

    function findFLById($id) {
        return D('friendly_link')->find($id);
    }

    function listAll($module) {
        if (!empty($module)) {
            $where['module'] = array('eq', $module);
        }
        return D('friendly_link')->where($where)->select();
    }

    function insert($fl) {
        D('friendly_link')->add($fl);
    }

    function update($fl) {
        D('friendly_link')->save($fl);
    }

    function delete($id) {
        D('friendly_link')->data(array('id' => $id))->delete();
    }

}

?>
